# Copyright 2022 Thales DIS SAS
#
# CVA6-specific testlist.  Written in the same format as riscv-dv testlists.
#
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
# You may obtain a copy of the License at https://solderpad.org/licenses/
#
# Original Author: Ayoub JALALI (ayoub.jalali@external.thalesgroup.com)

# ================================================================================
#                  Regression test list format
# --------------------------------------------------------------------------------
# test            : Assembly test name
# description     : Description of this test
# gen_opts        : Instruction generator options
# iterations      : Number of iterations of this test
# no_iss          : Enable/disable ISS simulator (Optional)
# gen_test        : Test name used by the instruction generator
# asm_tests       : Path to directed, hand-coded assembly test file or directory
# c_tests         : Path to directed, hand-coded C test file or directory
# rtl_test        : RTL simulation test name
# cmp_opts        : Compile options passed to the instruction generator
# sim_opts        : Simulation options passed to the instruction generator
# no_post_compare : Enable/disable comparison of trace log and ISS log (Optional)
# compare_opts    : Options for the RTL & ISS trace comparison
# gcc_opts        : gcc compile options
# --------------------------------------------------------------------------------

- test: riscv_mmu_stress_test
  description: >
    Test with different patterns of load/store instructions, stress test MMU
    operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=5
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,30
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,30
    +directed_instr_2=cva6_multi_page_load_store_instr_stream_c,30
    +directed_instr_3=cva6_mem_region_stress_test_c,30
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_mmu_stress_hint_test
  description: >
    Test with different patterns of load/store instructions, stress test MMU
    operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=5
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,30
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,30
    +directed_instr_2=cva6_multi_page_load_store_instr_stream_c,30
    +directed_instr_3=cva6_mem_region_stress_test_c,30
    +hint_instr_ratio=500
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_rand_jump_illegal_test
  description: >
    Jump among large number of sub-programs, stress testing iTLB operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=300
    +num_of_sub_program=0
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,10
    +directed_instr_1=riscv_jal_instr,20
    +illegal_instr_ratio=100
    +unsupported_instr_ratio=100
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_rand_jump_hint_comp_test
  description: >
    Jump among large number of sub-programs, stress testing iTLB operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +directed_instr_1=riscv_jal_instr,70
    +hint_instr_ratio=500
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_rand_jump_no_cmp_test
  description: >
    Jump among large number of sub-programs, stress testing iTLB operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +directed_instr_0=riscv_jal_instr,70
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_load_store_test
  description: >
    Unaligned load/store test
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_load_store=0
    +no_branch_jump=0
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,70
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,50
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_load_store_cmp_test
  description: >
    Unaligned load/store test
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_load_store=0
    +no_branch_jump=0
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,20
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,50
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_load_store_hazard_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +directed_instr_1=cva6_multi_page_load_store_instr_stream_c,50
    +no_data_page=0
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_xif_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_x_extension=1
    +disable_compressed_instr=1
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_xif_illegal_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_x_extension=1
    +illegal_instr_ratio=100
    +unsupported_instr_ratio=100
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_load_store_xif_test
  description: >
    Unaligned load/store test
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_load_store=0
    +no_branch_jump=1
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,20
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,50
    +tvec_alignment=8
    +enable_x_extension=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_rand_jump_xif_test
  description: >
    Jump among large number of sub-programs, stress testing iTLB operations.
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +directed_instr_1=riscv_jal_instr,70
    +enable_x_extension=1
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_test_no_comp
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test
  
- test: riscv_arithmetic_basic_test_comp
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_test_bcomp
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=0
    +boot_mode=m
    +no_csr_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_sub_prog_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=20
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_illegal
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +illegal_instr_ratio=100
    +unsupported_instr_ratio=100
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_unaligned_load_store_test
  description: >
    Unaligned load/store test
  gcc_opts: >
    -mno-strict-align
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=100
    +num_of_sub_program=0
    +no_branch_jump=1
    +no_data_page=0
    +directed_instr_0=cva6_load_store_rand_instr_stream_c,30
    +directed_instr_1=cva6_load_store_hazard_instr_stream_c,30
    +enable_unaligned_load_store=1
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_illegal_csr
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=5
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=0
    +enable_access_invalid_csr_level=1
    +disable_compressed_instr=1
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_hint_illegal_csr
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=0
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=0
    +enable_illegal_csr_instruction=1
    +hint_instr_ratio=150
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test 

- test: riscv_arithmetic_basic_illegal_hint_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +no_load_store=1
    +boot_mode=m
    +no_csr_instr=1
    +illegal_instr_ratio=100
    +unsupported_instr_ratio=100
    +hint_instr_ratio=100
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_loop_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=10
    +directed_instr_1=riscv_loop_instr,2
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_ebreak_dret_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +directed_instr_0=cva6_ecall_instr_stream_c,1
    +no_data_page=0
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +no_ebreak=0
    +no_dret=0
    +no_fence=0
    +tvec_alignment=8
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_same_reg_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=1000
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_same_reg=1
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_hazard_test_c
  rtl_test: core_base_test

- test: riscv_arithmetic_basic_hazard_rdrs1_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=1000
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_rdrs1_hazard=1
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_hazard_test_c
  rtl_test: core_base_test
  
- test: riscv_arithmetic_basic_hazard_rdrs2_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=1000
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +no_branch_jump=1
    +boot_mode=m
    +no_csr_instr=1
    +enable_rdrs2_hazard=1
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_hazard_test_c
  rtl_test: core_base_test

- test: riscv_interrupt_test
  description: >
    Arithmetic instruction test, no load/store/branch instructions no compressed
  gcc_opts: >
    -static
    -mcmodel=medany
    -fvisibility=hidden
    -nostdlib
    -nostartfiles
  gen_opts: >
    +instr_cnt=500
    +num_of_sub_program=0
    +no_fence=1
    +no_data_page=1
    +enable_interrupt=1
    +enable_timer_irq=1
    +no_branch_jump=1
    +no_wfi=0
    +boot_mode=m
    +no_csr_instr=1
    +tvec_alignment=8
    +disable_compressed_instr=1
    +enable_zba_extension=1
    +enable_zbb_extension=1
    +enable_zbc_extension=1
    +enable_zbs_extension=1
    +enable_zcb_extension=1
  iterations: 2
  gen_test: cva6_instr_base_test_c
  rtl_test: core_base_test
